Vagrant 共享文件夹报错 vboxsf is not available

本文问题与 [Vagrant 同步文件夹出现错误](Vagrant 同步文件夹出现错误.md) 解决方案相同.

当在 Vagrantfile 中指定 主机与虚拟机之间的共享文件夹的时候

1
config.vm.synced_folder "./data", "/data"

唤起 Vagrant 虚拟机 vagrant up 报错如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
==> default: Mounting shared folders...
default: /data => C:/Users/XXX/Documents/XXX/Vagrant/centos-7/data
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 data /data

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

主要原因是没有安装 vboxsf 支持插件, 执行

1
vagrant plugin install vagrant-vbguest

成功安装好插件后, 即可解决问题.

参考: https://github.com/geerlingguy/packer-centos-7/issues/18

Donate - Support to make this site better.
捐助 - 支持我让我做得更好.